<?php

namespace App\Models;

//use Illuminate\Database\Eloquent\Model;
//继承可以使用auth登陆的类
use Illuminate\Foundation\Auth\User as AuthUser;
//引入软删除类
use Illuminate\Database\Eloquent\SoftDeletes;
use App\Models\Role;
//按钮组
use App\Models\Traits\Btn;

class User extends AuthUser
{
    use SoftDeletes, Btn;//加上trait

    protected $table = 'users';
    //软删除标识字段
    protected $dates = ['deleted_at'];
    //拒绝不添加的字段
    protected $guarded = [];

    //隐藏字段 auth()->user()->toArray()就不会出现hidden的字段了
    protected $hidden = ['password'];

    //角色 属于
    public function rel_role() {
        return $this->belongsTo(Role::class, 'role_id');
    }

}
